using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using WMVConvert.Metadata;
using System.Drawing;

namespace WMVConvert.Tests.Metadata
{
	[TestClass]
	public class WMSynchronisedLyricsFixture
	{
		[TestMethod]
		[DeploymentItem("Test.wmv")]
		public void TestLyrics()
		{
			using (Editor editor = new Editor(Helper.PrepareceDeploymentItem("Test.wmv","TestLyrics")))
			{
				ushort langIndex = editor.Languages.Add("en");
				AddLyrics(editor, langIndex);
				langIndex = editor.Languages.Add("es");
				AddLyrics(editor, langIndex);
			}
		}

		private static void AddLyrics(Editor editor, ushort langIndex)
		{
			List<Syllable> lyrics = new List<Syllable>();
			lyrics.Add(new Syllable(String.Format("{0} Seconds, lang={1}", 3, langIndex), 3000));
			lyrics.Add(new Syllable(3500));
			lyrics.Add(new Syllable(String.Format("{0} Seconds, lang={1}", 4, langIndex), 4000));
			lyrics.Add(new Syllable(String.Format("{0} Seconds, lang={1}", 5, langIndex), 5000));
			lyrics.Add(new Syllable(String.Format("{0} Seconds, lang={1}", 6, langIndex), 6000));
			lyrics.Add(new Syllable(String.Format("{0} Seconds, lang={1}", 7, langIndex), 7000));
			lyrics.Add(new Syllable(8000));
			using (WMSynchronisedLyrics wmLyrics = new WMSynchronisedLyrics(lyrics))
			{
				WMAttribute wmAttrib = editor.Attributes.WMLyrics_Synchronised;
				wmAttrib.LangIndex = langIndex;
				editor.Add(wmAttrib, wmLyrics);
			}
		}
	}
}
